import 'package:sainbainu/common/models/response/content_response.dart';

/// 我的评论列表
class MyCommentListResponse {
  List<MyCommentResponse> rows;
  int total;

  MyCommentListResponse({
    required this.rows,
    required this.total,
  });

  factory MyCommentListResponse.fromJson(Map<String, dynamic> json) =>
      MyCommentListResponse(
        total: json['total'] as int,
        rows: (json['rows'] as List)
            .map((e) => MyCommentResponse.fromJson(e))
            .toList(),
      );
}

class MyCommentResponse {
  int? commentId;
  String? text;
  String? image;
  String? audio;
  int? audioDuration;
  String? countryName;
  String? provinceName;
  String? cityName;
  String? createTime;
  ContentResponse? note;

  MyCommentResponse({
    this.commentId,
    this.text,
    this.image,
    this.audio,
    this.audioDuration,
    this.countryName,
    this.provinceName,
    this.cityName,
    this.createTime,
    this.note,
  });

  factory MyCommentResponse.fromJson(Map<String, dynamic> json) {
    return MyCommentResponse(
      commentId: json['commentId'] as int?,
      text: json['text'] as String?,
      image: json['image'] as String?,
      audio: json['audio'] as String?,
      audioDuration: json['audioDuration'] as int?,
      countryName: json['countryName'] as String?,
      provinceName: json['provinceName'] as String?,
      cityName: json['cityName'] as String?,
      createTime: json['createTime'] as String?,
      note: ContentResponse.fromJson(json['note'] as Map<String, dynamic>),
    );
  }

  Map<String, dynamic> toJson() => {
        'commentId': commentId,
        'text': text,
        'image': image,
        'audio': audio,
        'audioDuration': audioDuration,
        'countryName': countryName,
        'provinceName': provinceName,
        'cityName': cityName,
        'createTime': createTime,
        'note': note,
      };
}
